<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理系统</title>
<#include "/WEB-INF/content/include-public.html">
<#include "/WEB-INF/content/include-easyui.html">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="${request.contextPath}/res/core/center.css">
<script type="text/javascript" src="${request.contextPath}/res/core/center.js"></script>
<link rel="stylesheet" type="text/css" href="${request.contextPath}/res/core/head/head.css">
<script type="text/javascript" src="${request.contextPath}/res/core/center.js"></script>
<script type="text/javascript">
	function loadMenu(obj) {
		var tabs = $('#workbench').tabs('tabs');
		$.each(tabs, function(index2, item2) {
			$.each(tabs, function(index, item) {
				if (index2 != 0) {
					$('#workbench').tabs('close', index2);
				}
			});
		});
		$("#tree").html("<div style=\"text-align: center;width: 100%;\">请等待，正在加载......<div>");
		$('#tree').tree({
					url : "${request.contextPath}/loadMenu/" + obj,
					onClick : function(node) {
						var res = $('#tree').tree("isLeaf", node.target);
						if (res) {
							if (node.attributes.url != null
								&& node.attributes.url != "null"
								&& node.attributes.url != "")
								console.log(node.attributes.url);
								openModule(node.id, node.text,node.attributes.url);
							//window.location.href = "http://www.baidu.com";
						} else {
							$('#tree').tree("toggle", node.target);
						}
					},
					onLoadError : function(obj) {
						$("#tree").html("<div style=\"text-align: center;width: 100%;color: red;\">加载失败，请重新<a href=\"javascript:top.location.href='${request.contextPath}/center';\">刷新</a>页面<div>");
					}
		});
	}
	$(function() {
		$(".role").click(function() {
			loadMenu($(this).attr("role"));
			$("#role_text").html($(this).text());
		});
		loadMenu($("#currRole").attr("role"));
		/* $("#aaaa").click(function(){
			$.post("${request.contextPath}/change",function(data){
				alert(data.info);
			});
		}); */
	});
</script>
<style type="text/css">
</style>
</head>
<body class="easyui-layout">
	<div region="north" border="false"
		style="height: 120px; background: #eee; overflow: hidden;">
		<div id="head_bg">
			<div class="logo">
				<img src="${request.contextPath}/res/core/head/images/logo_bg.jpg" width="880" height="90" />
			</div>
		</div>
		<div id="menu">
			<div class="left">
				<div class="menu_ico">
					<img src="${request.contextPath}/res/core/head/images/ico_01.jpg" />
				</div>
				<div id="roles">
					<#list map["roles"] as role>
					<#if role_index==0>
					<#assign currRole="${role.code}">
					<#assign currRoleName="${role.name}">
					</#if>
					<div class="role" role="${role.code}">${role.name}</div>
					</#list>
				</div>
				<div class="menu_txt">
					账号：[${(SESSION_CURRENT_USER.account)!}&nbsp;&nbsp;${(SESSION_CURRENT_USER.name)!}]
				</div>
				<div class="menu_ico">
					<img src="${request.contextPath}/res/core/head/images/ico_01.jpg" />
				</div>
				<div class="menu_txt">
					当前角色：<a href="#" id="currRole" class="easyui-menubutton" role="${currRole!}" data-options="menu:'#roles'"><span id="role_text">${currRoleName!}</span></a>
				</div>
			</div>
			<div class="right">
				<input class="menu_button01" name="" type="button" onclick="javascript:location.href='logout'" />
				<!-- <input class="menu_button02" name="" type="button" /> -->
				<!-- <input type="button" value="切换数据库" id="aaaa"> -->
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<div region="south" border="false" style="height: 25px; text-align: center; font-size: 12px; background: #eee; padding-top: 3px">Copyright © 2016, 重庆道恩科技有限公司, All Rights Reserved</div>
	<div region="west" split="true" title="菜单                欢迎登录：${(map['account']!).account!}" border="false" style="width: 200px; background: #eee;">
		<div class="easyui-accordion" style="width: 300px; height: 200px; overflow: auto;" fit="true">
			<ul id="tree"></ul>
		</div>
	</div>
	<div region="center" style="padding: 5px; background: #eee;">
		<div id="workbench" class="easyui-tabs" fit=true>
			<div title="欢迎" style="overflow: auto;">
				<table width="100%" height="100%">
					<tr>
						<td align="center"><img alt="欢迎使用管理平台" src="${request.contextPath}/images/welcome.gif"></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</body>
</html>
